JavaScript: Substring
This sample JavaScript custom scripting function maps the first three characters of the location code as the region ID and the last five characters as the postal code.
JavaScript example
| Inputs | • locationCode (Character) |
|---|---|
| Outputs | • regionId • postalCode |
| Script | region = locationCode.substring(0, 3);postalCode = locationCode.substring(locationCode.length-5, locationCode.length); |
Groovy example
| Inputs | • locationCode (Character) |
|---|---|
| Outputs | • regionId • postalCode |
| Script | region = locationCode.substring(0, 3);postalCode = locationCode.substring(locationCode.length()-5, locationCode.length()); |